﻿namespace _09_TetrisWork
{
    internal class Shape_J : Shape
    {
        public Shape_J(ref Map map) : base(ref map)
        {
            Update();
        }
        public override void Update()
        {
            a = ConsoleColor.DarkBlue;
            switch (dir)
            {
                case Direction.Up:
                    blocks[0].pos.x = pos.x - 1;
                    blocks[0].pos.y = pos.y - 1;
                    blocks[1].pos.x = pos.x - 1;
                    blocks[1].pos.y = pos.y;
                    blocks[2].pos = pos;
                    blocks[3].pos.x = pos.x + 1;
                    blocks[3].pos.y = pos.y;
                    break;
                case Direction.Right:
                    blocks[0].pos.x = pos.x + 1;
                    blocks[0].pos.y = pos.y - 1;
                    blocks[1].pos.x = pos.x;
                    blocks[1].pos.y = pos.y - 1;
                    blocks[2].pos = pos;
                    blocks[3].pos.x = pos.x;
                    blocks[3].pos.y = pos.y + 1;
                    break;
                case Direction.Down:
                    blocks[0].pos.x = pos.x + 1;
                    blocks[0].pos.y = pos.y + 1;
                    blocks[1].pos.x = pos.x + 1;
                    blocks[1].pos.y = pos.y;
                    blocks[2].pos = pos;
                    blocks[3].pos.x = pos.x - 1;
                    blocks[3].pos.y = pos.y;
                    break;
                case Direction.Left:
                    blocks[0].pos.x = pos.x - 1;
                    blocks[0].pos.y = pos.y + 1;
                    blocks[1].pos.x = pos.x;
                    blocks[1].pos.y = pos.y + 1;
                    blocks[2].pos = pos;
                    blocks[3].pos.x = pos.x;
                    blocks[3].pos.y = pos.y - 1;
                    break;
            }
        }
    }
}
